package com.git.smp;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;

import org.activiti.spring.boot.SecurityAutoConfiguration;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

import com.git.smp.controller.SmpServiceController;
import com.git.smp.dao.SmpServiceMapper;
import com.git.smp.dao.SmpSystemMapper;
import com.git.smp.entity.SmpServiceExtend;
import com.git.smp.entity.SmpSystem;

@SpringBootApplication(exclude = {org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,SecurityAutoConfiguration.class})
@MapperScan(basePackages = "com.git.smp.dao")
@ServletComponentScan
public class SmpApplication {
	
	
	public static void main(String[] args) throws IOException {
		
		//ConfigurableApplicationContext context = 
		SpringApplication.run(SmpApplication.class, args);
		/*
		 * SmpServiceController smpServiceController =
		 * context.getBean(SmpServiceController.class);
		 * 
		 * 
		 * SmpServiceMapper smpServiceMapper = context.getBean(SmpServiceMapper.class);
		 * 
		 * 
		 * SmpSystemMapper smpSystemMapper = context.getBean(SmpSystemMapper.class);
		 * 
		 * 
		 * String [] systemNos =
		 * {"001","002","003","004","006","009","010","011","018","021","022","023",
		 * "025","026","029","032","033","034","036","038","039","040","041","047","048"
		 * ,"049","053","056","058","059","060","061","065","094","096","097","099",
		 * "100","101","104","106","107","110","113","114","119","122","123","125","129"
		 * ,"130","131","134","135","136","138","142","143","144","147","148","149",
		 * "151","155","156","157","159","160","163","166","167","168","169","172","173"
		 * ,"174","175","177","178","179","180","182","184","185","186","188","189"};
		 * 
		 * for(String systemNo :systemNos) { SmpServiceExtend smpServiceExtend = new
		 * SmpServiceExtend(); smpServiceExtend.setSystemNo(systemNo);
		 * smpServiceExtend.setStatus("02");
		 * 
		 * SmpSystem smpSystem = smpSystemMapper.getSystemInfo(systemNo);
		 * List<SmpServiceExtend> listSmpService =
		 * smpServiceMapper.getServiceByPage(smpServiceExtend);
		 * 
		 * File file = new File("D://20241101/"+smpSystem+"("+systemNo+").xls");
		 * file.createNewFile();
		 * 
		 * OutputStream out = new FileOutputStream(file);
		 * 
		 * 
		 * smpServiceController.buildService(out, listSmpService); out.close(); }
		 */
	}
	
	@Bean
	public RestTemplate restTemplate() {
		return new RestTemplate();
	}

}
